package com.gluck.cases.core.modal.assemble;

import com.gluck.cases.core.modal.dto.RolePermissionDTO;
import com.gluck.cases.core.modal.entity.RolePermission;

import java.util.Objects;


/**
 * @ClassName RoleAssemble
 * @Desc Role 组装类
 * @Author I am Gluck
 * @Date 2022/5/17 - 8:07 下午
 **/
public class RolePermissionAssemble {

    public static RolePermission rolePermissionDTOConverRolePermission(RolePermissionDTO dto){
        RolePermission rolePermission = new RolePermission();
        if(!Objects.isNull(dto.getId()) || dto.getId() != 0){
            rolePermission.setId(dto.getId());
        }
        rolePermission.setPermissionId(dto.getPermissionId());
        rolePermission.setRoleId(dto.getRoleId());
        rolePermission.setCreatedBy(dto.getCreatedBy());
        return rolePermission;
    }

}
